#!/bin/bash

echo "请输入一个文件名："
read filename
if [ -e ${filename} ]; then
    if [ -f ${filename} ]; then
        echo "文件是普通文件，信息如下："
        echo `ls -alsh ${filename}`
    else
        if [ -d ${filename} ]; then
            echo "文件是一个目录"
            echo "delete it? [Y|N]"
            read action
            if [ $action == "Y" ]; then
                echo "文件已删除，退出！"
            else
                echo "不做处理，退出！"
            fi
        else
            echo "文件不是一个目录，退出！"
        fi
    fi
else 
    echo "文件不存在，退出！"
fi
